home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4772 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: division problem
  5. Date: Tue, 06 Feb 96 20:42:35 GMT
  6. Organization: none
  7. Message-ID: <823639355snz@genesis.demon.co.uk>
  8. References: <31097D77.11AA@rain.org> <26JAN199622082450@erich.triumf.ca> <4eh246$u6h@airdmhor.gen.nz> <4ej4ha$66@fountain.mindlink.net> <DLzvGG.2rn@uns.bris.ac.uk> <4emuba$1mo@fountain.mindlink.net> <823118692snz@genesis.demon.co.uk> <4eqm6q$bdk@airdmhor.gen.nz>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4eqm6q$bdk@airdmhor.gen.nz>
  15.            gumboot@airdmhor.gen.nz "Simon Hosie" writes:
  16.  
  17. >> Still no need to use floating point,
  18. >> celcius = ((fahrenheit - 32) * 5 + 4) / 9
  19. >
  20. >genew@mindlink.bc.ca "Gene Wirchenko" writes:
  21. >> Let's assume that you had never run across fahrenheit to celsius
  22. >> conversion before (because the above could just as easily be a case of
  23. >> converting flibbles to meeblesnauzers).
  24. >>
  25. >>     Can you derive the ORIGINAL formula for conversion of F to C?
  26. >>
  27. >>     If yes, how?  Because you don't know what the 4 is for.
  28. >
  29. >Lawrence Kirby:
  30. >> Maybe not but its effect is clearly one of rounding. Perhaps it would be
  31. >> clearer to specify it as (9/2), perhaps not.
  32. >
  33. >  It's not perfect rounding (you should have seen my examply by now).
  34.  
  35. Yes, it is perfect rounding (at least for positive results but your version
  36. has similar problems for negative results).  If you don't believe me
  37. try to find a case (with a positive result) where your expression
  38. generates a different result to mine.
  39.  
  40. > And
  41. >you can get the original formula back as long as you know that you're
  42. >working with integers.
  43.  
  44. As you can from mine.
  45.  
  46. >genew@mindlink.bc.ca "Gene Wirchenko" writes:
  47. >> If no, then it's unclear code, isn't it?
  48. >
  49. >Lawrence Kirby:
  50. >> How would you express it more clearly?
  51. >
  52. >  I'd just put a comment next to it if I thought it was necessary.
  53.  
  54. Yes, but that doesn't answer the question of how you make the expression
  55. itself clearer.
  56.  
  57. -- 
  58. -----------------------------------------
  59. Lawrence Kirby | fred@genesis.demon.co.uk
  60. Wilts, England | 70734.126@compuserve.com
  61. -----------------------------------------
  62.